#ifndef __DOUBLECIRCLELINKLIST_H_
#define __DOUBLECIRCLELINKLIST_H_

#include <stdbool.h>

#define ElementType int

typedef struct Node
{
    ElementType data; //存储的数据
    struct Node* prev;//前继节点
    struct Node* next;//后继节点 
}Node;

typedef struct DoubleCircleLinkList
{
    struct Node* head;//头指针，无头结点
    struct Node* tail;//尾指针，无头结点
    int len;          //有效节点个数
}DClist;

//初始化
int DClistInit(DClist* list);
//销毁双向循环链表
void DClistDestroy(DClist* list);
//打印
void DClistPrint(DClist* list);
//尾插
void DClistInsertTail(DClist* list, ElementType element);
//头插
void DClistInsertHead(DClist* list, ElementType element);
//尾删
void DClistPopBack(DClist* list);
//头删
void DClistPopFront(DClist* list);
//按下标插入
DClist* DClistInsertByIndex(DClist* list, int index, ElementType element);
//按位删除
void DClistRemoveByIndex(DClist* list, int index);
//查找第一个值符合的元素
int DClistFindFirstByElement(DClist* list, ElementType element);
//按值删除
void DClistRemoveByElement(DClist* list, ElementType element);
//查找下标所对应的值
ElementType DClistFindByIndex(DClist* list, int index);
//通过下标设定值
void DClistSetValueByIndex(DClist* list, int index, ElementType element);
//更改元素值
void DClistSetValueByElement(DClist* list, ElementType oldValue, ElementType newValue);




#endif
